<template>
	<view class="cargo_management">
		<view class="main" v-if="goods_image">
			<view class="goods_info">
				<image :src="goods_image" mode="aspectFill"></image>
				<view class="info">
					<view class="name one-txt-cut">{{goods_name}}</view>
					<view class="num">
						<text class="left">￥{{wyy}}</text>
						<!-- <text class="right">0.8件</text> -->
					</view>
					<view class="all_money">
						<text>总价：</text>￥{{money}}
					</view>
				</view>
			</view>
			<!--  -->
			<view class="main_con" :class="id?'main_con_a':''">
				<view class="con_text">
					<view class="t_top">
						<image src="@/static/images/g_icon1.png" mode=""></image>
						<text>上午仓位</text>
					</view>
					<!-- <view class="kc_num">0.0件</view> -->
					<view class="all_price">
						<text>总价：</text>￥{{morning_money}}
					</view>
					<view class="btn1" @click="navBtn(1)" v-if="id==''">出货</view>
					<view class="btn1" @click="navBtn(2)" v-if="id==''">提货</view>
					<view class="btn2" @click="navBtn(3)" v-if="id==''">库存转积分</view>
				</view>
				<view class="con_text">
					<view class="t_top">
						<image src="@/static/images/g_icon2.png" mode=""></image>
						<text>下午仓位</text>
					</view>
					<!-- <view class="kc_num">0.0件</view> -->
					<view class="all_price">
						<text>总价：</text>￥{{afternoon_money}}
					</view>
					<view class="btn1" @click="navBtn(5)" v-if="id==''">出货</view>
					<view class="btn1" @click="navBtn(2)" v-if="id==''">提货</view>
					<view class="btn2" @click="navBtn(3)" v-if="id==''">库存转积分</view>
				</view>
			</view>
			<!--  -->
			<view class="bot_btn" @click="navBtn(4)" v-if="id==''">出入库记录</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id:'',
				goods_image:'',
				goods_name:'',
				wyy:'',
				money:'',
				morning_money:'',
				afternoon_money:'',
			};
		},
		onLoad(opt) {
			if(opt.id){
				this.id=opt.id
			}
			this.infoData()
		},
		methods:{
			// 
			infoData(){
				var that = this
				that.$tips.showLoading('加载中')
				var params = {
					user_id:that.id
				}
				that.$httpApi.wuhuo(params).then((res)=>{
					that.$tips.hideLoading()
					if(res.code==1){
						that.goods_image=res.data.goods_image
						that.goods_name=res.data.goods_name
						that.wyy=res.data.wyy
						that.money=res.data.money
						that.morning_money=res.data.morning_money
						that.afternoon_money=res.data.afternoon_money
					}
				})
			},
			navBtn(type){
				if(type==1){
					uni.navigateTo({
						url:'/pages/shop/shop_sell?type=1'
					})
				}
				if(type==5){
					uni.navigateTo({
						url:'/pages/shop/shop_sell?type=2'
					})
				}
				if(type==2){
					this.$store.commit('SET_INDEX',3)
					setTimeout(function(){
						uni.switchTab({
							url:'/pages/mall/mall'
						})
					},500)
				}
				if(type==3){
					uni.navigateTo({
						url:'/pages/shop/inv_stock'
					})
				}
				if(type==4){
					 uni.navigateTo({
					 	url:'/pages/shop/cargo_records'
					 })
				}
			}
		}
	}
</script>

<style lang="less">
	.cargo_management{
		width: 100%;
		padding-top: 24rpx;
		.main{
			width: 100%;
			background: #fff;
			.goods_info{
				width: 100%;
				padding: 32rpx;
				display: flex;
				image{
					display: block;
					width: 168rpx;
					height: 168rpx;
					border-radius: 10rpx;
				}
				.info{
					width: calc(100% - 168rpx);
					padding-left: 20rpx;
					height: 168rpx;
					display: flex;
					justify-content: space-between;
					flex-direction: column;
					.name{
						width: 100%;
						font-size: 32rpx;
						font-family: PingFang SC-Medium, PingFang SC;
						font-weight: 500;
						color: #222222;
					}
					.num{
						width: 100%;
						display: flex;
						align-items: center;
						justify-content: space-between;
						.left{
							font-size: 28rpx;
							font-family: PingFang SC-Medium, PingFang SC;
							font-weight: 500;
							color: #222222;
						}
						.right{
							font-size: 28rpx;
							font-family: PingFang SC-Regular, PingFang SC;
							font-weight: 400;
							color: #666666;
						}
					}
					.all_money{
						width: 100%;
						font-size: 32rpx;
						font-family: PingFang SC-Bold, PingFang SC;
						font-weight: bold;
						color: #333333;
						text{
							font-size: 28rpx;
							font-family: PingFang SC-Regular, PingFang SC;
							font-weight: 400;
							color: #222222;
						}
					}
				}
			}
			.main_con{
				width: 100%;
				padding: 0 32rpx;
				display: flex;
				justify-content: space-between;
				.con_text{
					width: 332rpx;
					padding: 32rpx 0;
					background: #F7F7F9;
					border-radius: 10rpx;
					.t_top{
						width: 100%;
						display: flex;
						align-items: center;
						justify-content: center;
						image{
							display: block;
							width: 40rpx;
							height: 40rpx;
						}
						text{
							padding-left: 8rpx;
							font-size: 32rpx;
							font-family: PingFang SC-Regular, PingFang SC;
							font-weight: 400;
							color: #222222;
						}
					}
					.kc_num{
						width: 100%;
						text-align: center;
						padding-top: 16rpx;
						font-size: 28rpx;
						font-family: PingFang SC-Regular, PingFang SC;
						font-weight: 400;
						color: #666666;
					}
					.all_price{
						width: 100%;
						text-align: center;
						padding-top: 16rpx;
						padding-bottom: 20rpx;
						font-size: 28rpx;
						font-family: PingFang SC-Bold, PingFang SC;
						font-weight: bold;
						color: #FF6230;
						text{
							font-weight: 400;
							color: #999999;
						}
					}
					.btn1{
						margin: 16rpx auto 0;
						width: 260rpx;
						height: 60rpx;
						line-height: 60rpx;
						border-radius: 30rpx;
						font-size: 28rpx;
						color: #fff;
						background: #26C281;
						text-align: center;
						font-family: PingFang SC-Regular, PingFang SC;
						font-weight: 400;
					}
					.btn2{
						margin: 16rpx auto 0;
						width: 260rpx;
						height: 60rpx;
						line-height: 60rpx;
						border-radius: 30rpx;
						font-size: 28rpx;
						color: #26C281;
						border: 1rpx solid #26C281;
						text-align: center;
						font-family: PingFang SC-Regular, PingFang SC;
						font-weight: 400;
					}
				}
			}
			.main_con_a{
				padding-bottom: 30rpx;
			}
			.bot_btn{
				width: 100%;
				text-align: center;
				line-height: 100rpx;
				font-size: 32rpx;
				font-family: PingFang SC-Regular, PingFang SC;
				font-weight: 400;
				color: #26C281;
			}
		}
	}
</style>
